<template>
	<view class="rent-pages">
		<view class="menu-item">
			<view class="menu" :class="menuTab==1?'active':''" @click="changMenu(1)">保证金缴纳</view>
			<view class="menu" :class="menuTab==2?'active':''" @click="changMenu(2)">缴纳记录</view>
		</view>
		<view class="info-item" v-for="item in list" :key="item.id" v-if="menuTab==1">
			<view class="rent-item">
				<view class="rent-info">
					<image :src="imgStorage+'/login/lianzu.png'" class="info-icon" v-if="item.type==1"></image>
					<image :src="imgStorage+'/login/gongzu.png'" class="info-icon" v-else-if="item.type==2"></image>
					<image :src="imgStorage+'/login/zhiguan.png'" class="info-icon" v-else-if="item.type==3"></image>
					<view class="title">{{item.name}}</view>
				</view>
				<view class="small-btn normal" v-if="item.type==1" @click="navigate('/page_pack/bond/bond')">缴纳</view>
				<view class="text" v-if="item.type==2" style="color: #18aa00;">已缴纳</view>
				<view class="text" v-if="item.type==3" style="color: #767676;">已退回</view>
			</view>
		</view>
		<template v-if="menuTab==2">
			<PaymentRecords :info-list="list1"></PaymentRecords>
		</template>
	</view>
</template>

<script>
	import {
		PaymentRecords
	} from '@/components/PaymentRecords/PaymentRecords.vue'
	export default {
		components: {
			PaymentRecords
		},
		data() {
			return {
				menuTab: 1,
				list: [{
						id: 1,
						type: 1,
						name: '北片世博花园12#4-401'
					},
					{
						id: 2,
						type: 2,
						name: '北片世博花园12#4-402'
					},
					{
						id: 3,
						type: 3,
						name: '北片世博花园12#4-403'
					}
				],
				list1: [{
						id: 1,
						type: 1,
						name: '北片世博花园12#4-401',
						title: '保证金缴纳',
						price: '-500',
						rentTime: '2025-02-25 18：24',
					},
					{
						id: 2,
						type: 1,
						name: '北片世博花园12#4-401',
						title: '保证金缴纳',
						price: '-500',
						rentTime: '2025-02-25 18：24',
					}
				]
			}
		},
		methods: {
			changMenu(e) {
				this.menuTab = e
			}
		},
		onLoad(e) {
			if (e.type) {
				this.menuTab = e.type
			}
		},
		onShow() {}
	}
</script>

<style lang="scss" scoped>
	.rent-pages {
		padding: 30rpx;

		.menu-item {
			display: flex;
			align-items: center;
			justify-content: space-between;
			margin-bottom: 30rpx;

			.menu.active {
				background-color: $theme-color;
				color: #fff;
			}

			.menu {
				width: calc(50% - 15rpx);
				height: 65rpx;
				display: flex;
				align-items: center;
				justify-content: center;
				background-color: #fff;
				border-radius: 10rpx;
				font-size: 30rpx;
				color: #767676;
			}
		}

		.info-item {
			width: 100%;
			border-radius: 20rpx;
			background-color: #fff;
			padding: 50rpx 30rpx;
			margin-bottom: 30rpx;

			.rent-item {
				width: 100%;
				display: flex;
				align-items: center;
				justify-content: space-between;

				.rent-info {
					width: calc(100% - 150rpx);
					display: flex;
					align-items: center;

					.info-icon {
						width: 40rpx;
						height: 40rpx;
						margin-right: 10rpx;
					}

					.title {
						width: calc(100% - 50rpx);
						font-size: 32rpx;
						font-weight: bold;
						overflow: hidden;
						text-overflow: ellipsis;
						white-space: nowrap;
					}
				}

				.small-btn {
					width: 150rpx;
					height: 60rpx;
					font-size: 28rpx;
				}

				.text {
					font-size: 30rpx;
				}
			}
		}
	}
</style>